{extend name="v1/layout/base"}
{block name="content"}
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <style>
    /* .layui-col-lg8{
      display:flex;
      align-items:center;
    } */
  </style>
  <ul class="layui-tab-title">
    {volist name="system_config_site" id="vo"}
    <li class="{$key == 1?'layui-this':''}">{$vo}</li>
    {/volist}
  </ul>
  <div class="layui-tab-content">
    {volist name="list" id="vo"}
    {assign name="public_key" value="$key"}
    <div class="layui-tab-item {$public_key == 1?'layui-show':''}">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <form class="layui-card-body layui-form layui-form-pane">
              {volist name="$vo['list']" id="volist" key="keyx" }
              {switch name="$volist['type_id']"}
              {case value="1"}
              <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg8">
                  <label class="layui-form-label">{$volist.name}({$volist.sign})：</label>
                  <div class="layui-input-block">
                    <input type="text" name="value[{$volist['config_id']}]" placeholder="请输入{$volist.name}" value="{$volist.content}" autocomplete="off" class="layui-input">
                  </div>
                </div>
              </div>
              {/case}
              {case value="2"}
              <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg8">
                  <label class="layui-form-label">{$volist.name}({$volist.sign})：</label>
                  <div class="layui-input-block">
                    <div class="layui-upload">
                      <div class="xk-big-show" datasrc="{$volist['show_content']!=''?$volist['show_content']:'__COMMON__images/no_pic.png'}">
                        <input type="hidden" class="xk-picurl" name="value[{$volist['config_id']}]" value="{$volist.content}">
                        <img class="layui-upload-img  xk-img upload-pic" id="img-show-1" src="{$volist['show_content']!=''?$volist['show_content']:'__COMMON__images/no_pic.png'}" width="100px" height="100px">
                      </div>
                      {if condition="$volist['content']"}
                      <button class="layui-btn layui-btn-danger layui-btn-sm xk-del-pic" type="button" name="button"><i class="layui-icon">&#xe640;</i></button>
                      {/if}
                    </div>
                  </div>
                </div>
              </div>
              {/case}
              {case value="3"}
              <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg8">
                  <label class="layui-form-label">{$volist.name}({$volist.sign})：</label>
                  <div class="layui-input-block">
                    <textarea class="layui-textarea" name="value[{$volist['config_id']}]" id="des" rows="8" cols="80">{$volist.content}</textarea>
                  </div>
                </div>
              </div>
              {/case}
              {case value="5"}
              <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-col-lg8">
                  <label class="layui-form-label">{$volist.name}({$volist.sign})：</label>
                  <div class="layui-input-block">
                    <input type="radio" name="value[{$volist['config_id']}]" value="1" title="是" {$volist['content']==1?'checked':($volist["content"] != 0?"checked":"")}>
                    <input type="radio" name="value[{$volist['config_id']}]" value="0" title="否" {$volist['content']==0?'checked':''}>
                  </div>
                </div>
              </div>
              {/case}
              {/switch}
              {/volist}
              <!-- 底部操作按钮 -->
              <div class="layui-row">
                <div class="layui-col-xs3">&nbsp;</div>
                <div class="layui-col-xs4">
                  <!--<button type="button" class="layui-btn layui-btn-warm layui-btn-radius" lay-submit lay-filter="addBtn" data-url="/{:config('manage.manage_name')}/{:config('manage.version')}/System/configList" data-site_id='{$public_key}'><i class="layui-icon">&#xe656;</i>系统变量</button>-->
                  <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="saveBtn" data-url="/{:config('manage.manage_name')}/{:config('manage.version')}/System/configSave"><i class="layui-icon">&#xe609;</i>立即更新</button>
                </div>
                <div class="layui-col-xs5">&nbsp;</div>
              </div>
              <!-- 底部操作按钮结束 -->
            </form>
        </div>
      </div>
    </div>
    {/volist}
  </div>
</div>
{/block}
{block name="myScript"}
<script>
  layui.use(['form'], function() {
    var form = layui.form,
      layer = layui.layer,
      $ = layui.$;
    //监听提交
    form.on('submit(addBtn)', function(data) {
      let url = $(this).attr('data-url'),
          site_id = $(this).attr('data-site_id');
      url = url+'/site_id/'+site_id;
      console.log(url);
      var index = layer.open({
        title: '系统变量管理',
        type: 2,
        shade: 0.2,
        maxmin: true,
        shadeClose: true,
        area: ['100%', '100%'],
        content: url,
        cancel: function () {
          window.location.reload();
        }
      });
    });
    form.on('submit(saveBtn)',function(data){
      var data = data.field,
          url = $(this).attr('data-url');
      https(url, data, 'post', false, '正在保存信息').then(res => {
        if (res.result_code == 200) {
          xkInfoMsg(res.result_msg);
        }
      }, fail => {})
      return false;
    })

  });
</script>
{/block}
